<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
use App\Buyer_info;
use App\Seller_info;
use Validate;

class TemplistController extends Controller
{

    /*//利用中间件检测用户的登录状态.
    protected $middleware = ['App\Http\Middleware\Authenticate'=>[] ];*/
    
    //卖家临时列表
    public function muserlist(){
        $sell = Seller_info::orderBy('sid','desc')->paginate(10);
        return view('admin.muserlist',['sell'=>$sell]);
    }
    //买家临时列表
    public function buserlist(){
        $buy = Buyer_info::orderBy('bid','desc')->paginate(10);
    	return view('admin.buserlist',['buy'=>$buy]);
    }
    //卖家审核
    public function musercheck($sid){
        $mobile = seller_info::find($sid);
        $mobile->s_status = 1;
        $mobile->save();
           
    	return view('admin.musercheck',['mobile'=>$mobile]);     
    }
    //买家审核
    public function maijiashenhe($bid){
        $mobile = buyer_info::where('bid',$bid)->first();
        $mobile->b_status = 1;
        $mobile->save();

        return view('admin.maijiashenhe',['mobile'=>$mobile]);
    }
    //添加卖家手机号码
    public function addls(Request $req){
       // return '########';
        $this->validate($req,[
            'mobile'=>'required|regex:/^1[34578]\d{9}$/'
        ],[
            'mobile.required'=>'号码不能为空',
            'mobile.regex'=>'请填写正确的手机号码'
        ]);
        return DB::table('seller_infos')->insert(['s_mobile'=>$req->mobile])?1:0;

    }

}

                           
               






?>